<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">

<head>
    <meta charset="UTF-8">
    <title>任务单列表</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <link rel="icon" th:href="@{/static/console/common/images/favicon.ico}">
    <link rel="stylesheet" type="text/css" th:href="@{/static/css/element/index.css}"/>
    <link rel="stylesheet" type="text/css" th:href="@{/static/console/css/production/indent.css?version=202504031053}"/>
</head>

<body>
<div id="container">
    <el-container>
        <el-header height="40">
            <!--<span class="demonstration">日期:</span>-->
            <el-date-picker v-model="tableSearch.startDate"
                            type="datetime" size="mini"
                            :value-format="tableSearch.dateFormat"
                            placeholder="起始日期">
            </el-date-picker>
            <el-date-picker v-model="tableSearch.endDate"
                            type="datetime" size="mini"
                            :value-format="tableSearch.dateFormat"
                            placeholder="截止日期">
            </el-date-picker>
            <el-select v-model="tableSearch.proType" placeholder="供应状态" size="mini" clearable class="search-pro-type">
                <el-option v-for="item in indentTypeList"
                           :key="item.code"
                           :label="item.desc"
                           :value="item.code">
                </el-option>
            </el-select>
            <el-input v-model="tableSearch.searchVal" placeholder="搜索信息" clearable size="mini"></el-input>
            <el-button type="success" icon="el-icon-search" @click="searchDatas" size="mini">查询</el-button>
            <template th:if="${menuRole.isInsert == 1}">
                <el-button type="primary" icon="el-icon-plus" @click="showAddDialog" size="mini">添加</el-button>
            </template>
            <el-button type="info" icon="el-icon-download" size="mini" @click="exportData">导出</el-button>
        </el-header>
        <el-main>
            <template>
                <el-table :data="tableDatas" border v-loading="tableLoading" max-height="750">
                    <el-table-column label="序号"
                                     show-overflow-tooltip
                                     type="index"
                                     width="50"></el-table-column>
                    <el-table-column prop="code" show-overflow-tooltip
                                     label="任务单编号"
                                     width="210"></el-table-column>
                    <el-table-column show-overflow-tooltip
                                     label="合同编号"
                                     prop="conCode"
                                     width="150"></el-table-column>
                    <el-table-column show-overflow-tooltip
                                     prop="conName"
                                     label="工程名称"
                                     width="240"></el-table-column>
                    <el-table-column show-overflow-tooltip
                                     prop="site"
                                     label="施工部位"
                                     width="240"></el-table-column>
                    <el-table-column show-overflow-tooltip
                                     prop="builder"
                                     label="施工单位"
                                     width="240"></el-table-column>
                    <el-table-column show-overflow-tooltip
                                     prop="distance"
                                     label="运距(KM)"
                                     width="100"></el-table-column>
                    <el-table-column show-overflow-tooltip
                                     prop="strengthName"
                                     label="砼强度"
                                     width="180">
                    </el-table-column>
                    <el-table-column show-overflow-tooltip
                                     prop="tech"
                                     label="特性要求"
                                     width="180">
                    </el-table-column>
                    <el-table-column show-overflow-tooltip
                                     prop="planStere"
                                     label="计划方量(方)"
                                     width="120">
                    </el-table-column>
                    <el-table-column show-overflow-tooltip
                                     prop="castModelName"
                                     label="浇筑方式"
                                     width="150">
                    </el-table-column>
                    <el-table-column fixed="right"
                                     label="任务单状态"
                                     width="120">
                        <template scope="scope">
                            <template v-for="it in indentTypeList">
                                <template v-if="scope.row.type == it.code">
                                    <el-tag>{{it.desc}}</el-tag>
                                </template>
                            </template>
                        </template>
                    </el-table-column>
                    <el-table-column fixed="right"
                                     label="操作"
                                     width="280">
                        <template scope="scope">
                            <template th:if="${menuRole.isUpdate == 1}">
                                <el-button icon="el-icon-edit" size="mini" type="primary"
                                           @click="showEditDialog(scope.row)">修改
                                </el-button>
                            </template>
                            <template th:if="${menuRole.isInsert == 1}">
                                <el-button icon="el-icon-copy-document" size="mini" type="info"
                                           @click="showCopyDialog(scope.row)">复制
                                </el-button>
                            </template>
                            <template th:if="${menuRole.isDelete == 1}">
                                <template v-if="scope.row.isPro == 0">
                                    <!--  未开盘状态,可以进行删除  -->
                                    <el-popconfirm title="确定删除该任务单吗？" @confirm="delIndent(scope.row.id)">
                                        <el-button icon="el-icon-delete" size="mini" type="danger" slot="reference">删除
                                        </el-button>
                                    </el-popconfirm>
                                </template>
                            </template>
                        </template>
                    </el-table-column>
                </el-table>
                <el-pagination background
                               @size-change="handleSizeChange"
                               @current-change="handleCurrentChange"
                               :page-sizes="[50, 100, 200,500]"
                               :page-size="tableSearch.limit"
                               :current-page.sync="tableSearch.pageIndex"
                               layout="total,sizes, prev, pager, next"
                               :total="tableSearch.total">
                </el-pagination>
            </template>
        </el-main>
    </el-container>
    <template>
        <el-dialog :title="dialog.title" :visible.sync="dialog.show" width="95%" center v-loading="dialog.loading"
                   :close-on-click-modal="0" :show-close="0" custom-class="indent-dialog">
            <el-form label-position="right" label-width="140px" :inline="true" :model="indentForm" :rules="indentRules"
                     ref="indentForm">
                <el-form-item label="工程名称">
                    <el-popover placement="right" trigger="click" v-model="conPopover">
                        <div style="margin-bottom: 5px">
                            <el-input v-model="dialogSearch.searchVal" placeholder="工程名称" clearable
                                      size="mini"></el-input>
                            <el-button type="success" icon="el-icon-search" @click="searchCon" size="mini">查询
                            </el-button>
                        </div>
                        <el-table v-if="conPopover" :data="conList" max-height="250" border
                                  row-class-name="con-table-row"
                                  v-loading="dialogSearch.loading" @current-change="conChange">
                            <el-table-column width="210" property="code" label="合同编号"></el-table-column>
                            <el-table-column width="300" property="name" label="工程名称"
                                             show-overflow-tooltip></el-table-column>
                            <el-table-column width="300" property="clientName" label="客户名称"
                                             show-overflow-tooltip></el-table-column>
                            <!--<el-table-column width="100" property="contractCategoryTxt" label="工程类型"></el-table-column>-->
                        </el-table>
                        <el-input slot="reference" v-model="indentForm.exhibition.conName" readonly
                                  placeholder="点击选择合同" :disabled="dialog.update"></el-input>
                    </el-popover>
                </el-form-item>
                <el-form-item label="合同类型">
                    <el-input v-model="indentForm.exhibition.conCategory" readonly></el-input>
                </el-form-item>
                <el-form-item label="客户名称">
                    <el-input v-model="indentForm.exhibition.clientName" readonly></el-input>
                </el-form-item>
                <el-form-item label="销售人员">
                    <el-input v-model="indentForm.exhibition.sales" readonly></el-input>
                </el-form-item>
                <el-form-item label="前场工长">
                    <el-input v-model="indentForm.render.foreman" placeholder="前场工长"></el-input>
                </el-form-item>
                <el-form-item label="施工部位" class="indent-site" prop="render.site">
                    <el-input v-model="indentForm.render.site" placeholder="施工部位" type="textarea"
                              :disabled="dialog.update"></el-input>
                </el-form-item>
                <el-form-item label="砼强度" prop="render.strengthId">
                    <el-select v-model="indentForm.render.strengthId" filterable clearable placeholder="请先选择合同再选择生产标号"
                               :disabled="dialog.update">
                        <el-option v-for="item in strengthList"
                                   :key="item.id"
                                   :label="item.strength"
                                   :value="item.id">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="特性要求">
                    <el-select v-model="indentForm.exhibition.techItems" filterable clearable @change="$forceUpdate()"
                               placeholder="请先选择合同再选择特性要求" multiple value-key="id">
                        <el-option v-for="item in techList"
                                   :key="item.id"
                                   :label="item.equirement"
                                   :value="item">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="塌落度" class="indent-slumps" prop="render.slumps">
                    <el-input v-model="indentForm.render.slumps" placeholder="塌落度"
                              :disabled="dialog.update">
                        <!--<el-select v-model="indentForm.render.slumpsSuffix" slot="append">
                            <el-option label="±10" value="±10"></el-option>
                            <el-option label="±20" value="±20"></el-option>
                            <el-option label="±30" value="±30"></el-option>
                        </el-select>-->
                    </el-input>
                </el-form-item>
                <el-form-item label="运距" prop="render.distance">
                    <el-input v-model.number="indentForm.render.distance" placeholder="运距" type="number">
                        <template slot="append">KM</template>
                    </el-input>
                </el-form-item>
                <br>
                <el-form-item label="浇筑方式" prop="render.castModeId">
                    <el-select v-model="indentForm.render.castModeId" filterable clearable placeholder="浇筑方式"
                               value-key="id">
                        <el-option v-for="item in castModeList"
                                   :key="item.id"
                                   :label="item.name"
                                   :value="item.id"
                                   @click.native="castModeChange(item)">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="泵送设备">
                    <el-select v-model="indentForm.render.pumpDeviceId" filterable
                               placeholder="泵送设备" :disabled="dialog.device">
                        <el-option v-for="item in pumpDeviceList"
                                   :key="item.id"
                                   :label="item.name"
                                   :value="item.id"
                                   @click.native="pumpDeviceChange(item)">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="泵送类型">
                    <el-select v-model="indentForm.render.pumpTypeId" filterable clearable placeholder="泵送类型"
                               :disabled="dialog.device">
                        <el-option v-for="item in pumpTypeList"
                                   :key="item.id"
                                   :label="item.name"
                                   :value="item.id">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="泵送规格">
                    <el-select v-model="indentForm.render.pumpNormId" filterable clearable placeholder="泵送类型"
                               :disabled="dialog.device">
                        <el-option v-for="item in pumpNormList"
                                   :key="item.id"
                                   :label="item.name"
                                   :value="item.id">
                        </el-option>
                    </el-select>
                </el-form-item>
                <br>
                <el-form-item label="工地地址">
                    <el-input v-model="indentForm.render.address" placeholder="工地地址"></el-input>
                </el-form-item>
                <el-form-item label="道路运输类型" prop="render.roadType">
                    <el-select v-model="indentForm.render.roadType" filterable clearable placeholder="道路运输类型">
                        <el-option v-for="item in roadTypeList"
                                   :key="item.code"
                                   :label="item.desc"
                                   :value="item.code">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="是否经过超限站" prop="render.overLimit">
                    <el-select v-model="indentForm.render.overLimit" filterable clearable placeholder="是否经过超限站">
                        <el-option v-for="item in overLimitList"
                                   :key="item.code"
                                   :label="item.desc"
                                   :value="item.code">
                        </el-option>
                    </el-select>
                </el-form-item>
                <br>
                <el-form-item label="工地联系人">
                    <el-input v-model="indentForm.render.linkMan" placeholder="工地联系人"></el-input>
                </el-form-item>
                <el-form-item label="工地联系电话">
                    <el-input v-model="indentForm.render.linkPhone" placeholder="工地联系电话"></el-input>
                </el-form-item>
                <!--<el-form-item label="工地要求开盘时间" prop="render.builderStartTime">
                    <el-date-picker v-model="indentForm.render.builderStartTime" class="indent-time"
                                    format="yyyy-MM-dd HH:mm"
                                    value-format="yyyy-MM-dd HH:mm" type="datetime" placeholder="计划开盘时间"
                                    @change="chooseBuildTime">
                    </el-date-picker>
                </el-form-item>-->
                <el-form-item label="生产计划开盘时间" prop="render.dispatchStartTime">
                    <el-date-picker v-model="indentForm.render.dispatchStartTime" class="indent-time"
                                    format="yyyy-MM-dd HH:mm"
                                    value-format="yyyy-MM-dd HH:mm" type="datetime" placeholder="计划开盘时间">
                    </el-date-picker>
                </el-form-item>
                <br>
                <el-form-item label="计划方量" prop="render.planStere">
                    <el-input v-model.number="indentForm.render.planStere" type="number" placeholder="计划方量"></el-input>
                </el-form-item>
                <el-form-item label="任务单状态" prop="render.type">
                    <el-radio-group v-model="indentForm.render.type">
                        <template v-for="indentType in indentTypeList">
                            <el-radio :label="indentType.code">{{indentType.desc}}</el-radio>
                        </template>
                    </el-radio-group>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button type="primary" @click="onSubmit('indentForm')">确定</el-button>
                <el-button @click="cancel">取 消</el-button>
            </div>
        </el-dialog>
    </template>
</div>
</body>
<script type="text/javascript" th:src="@{/static/console/assets/js/jquery-3.2.1.min.js}"></script>
<script type="text/javascript" th:src="@{/static/console/js/pages/base.js}" charset="utf-8"></script>
<script type="text/javascript" th:src="@{/static/js/vue.min.js}"></script>
<script type="text/javascript" th:src="@{/static/js/element/index.js}"></script>
<script type="text/javascript" th:src="@{/static/console/datepicker/jquery-datePicker.js}" charset="utf-8"></script>
<script th:inline="javascript">
    const categoryList = [[${categoryList}]];
    const roadTypeList = [[${roadTypeList}]];
    const indentTypeList = [[${indentTypeList}]];
    const overLimitList = [[${overLimitList}]];
</script>
<script type="text/javascript" th:src="@{/static/console/js/pages/production/indent.js?version=202506171623}"
        charset="utf-8"></script>

</html>